import axios from 'axios';
import vuex from '@/store';

export const login = ({ userName, password }) => {
  console.log('登陆接口', vuex.state.user);
  const data = {
    userName,
    password,
  };
  return axios.request({
    url: '/api/api/authenticate',
    data,
    method: 'post',
  });
};

export const getUserInfoAccount = token => {
  console.log('获取用户信息接口', vuex.state.user);
  return axios.request({
    url: '/api/api/account',
    headers: { Authorization: `Bearer ${token}` },
    method: 'GET',
  });
};
